Use notification destination ids in tools SDK#135
Conversation
WalkthroughThis PR migrates notification destination addressing from a provider:channelId format to UUID-based destination IDs. The tool contract schema is updated, the CLI command now validates and forwards comma-separated UUID IDs, and all CLI, Pi extension, and tools tests are updated to reflect the new addressing model. ChangesNotification Destination ID Migration
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
501dc91 to
6ea6b47
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/cli/src/commands/notify.ts`:
- Around line 12-13: The CLI's destinationIdPattern currently restricts UUID
version to [1-5], causing valid IDs (v7, nil, max) accepted by the contract to
be rejected; update the destinationIdPattern constant to match the contract
schema by allowing version digit [1-8] and explicitly permitting the nil UUID
(00000000-0000-0000-0000-000000000000) and the max UUID
(ffffffff-ffff-ffff-ffff-ffffffffffff) so the CLI validation aligns with
contracts.ts.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 7566d807-8462-4341-a4bf-e3fc5cd0f7d0
📒 Files selected for processing (6)
.changeset/agent-notification-destinations.mdpackages/cli/src/commands/notify.tspackages/cli/tests/commands/notify.test.tspackages/pi/tests/extension.test.tspackages/tools/src/contracts.tspackages/tools/tests/client.test.ts
| const destinationIdPattern = | ||
| /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i |
There was a problem hiding this comment.
UUID pattern mismatch between CLI and contract schema.
The CLI pattern allows only UUID versions 1-5 ([1-5]), while the contract schema in contracts.ts allows versions 1-8 ([1-8]) plus nil/max UUIDs. This means:
- A UUID v7 (e.g.,
01932c6a-7a6c-7e9d-8a1b-123456789012) would pass server-side validation but fail CLI validation. - The nil UUID (
00000000-0000-0000-0000-000000000000) explicitly allowed in the contract would fail CLI validation.
Consider aligning the CLI pattern with the contract schema to avoid rejecting valid destination IDs.
🔧 Proposed fix to align with contract schema
const destinationIdPattern =
- /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i
+ /^([0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/cli/src/commands/notify.ts` around lines 12 - 13, The CLI's
destinationIdPattern currently restricts UUID version to [1-5], causing valid
IDs (v7, nil, max) accepted by the contract to be rejected; update the
destinationIdPattern constant to match the contract schema by allowing version
digit [1-8] and explicitly permitting the nil UUID
(00000000-0000-0000-0000-000000000000) and the max UUID
(ffffffff-ffff-ffff-ffff-ffffffffffff) so the CLI validation aligns with
contracts.ts.
Summary
destinationIdsinstead of provider/channel destination objects.outlit notify --destinationto forward NotificationDestination ids.Validation
bun test packages/tools/tests/client.test.ts packages/cli/tests/commands/notify.test.tsbunx turbo run typecheck --filter=@outlit/tools --filter=@outlit/cliSummary by CodeRabbit
New Features
Documentation